#pragma once
#include "DXAMLCommon.h"

#include "CMultiParentShareableDependencyObject.h"

class CDependencyObject;
class CREATEPARAMETERS;
class CMILMatrix;
class CTransform;

class HitTestPolygon;

class CBrush :
	public CMultiParentShareableDependencyObject
{
protected: 
	CBrush(const CBrush & original, HRESULT & hr);
	CBrush();
	virtual ~CBrush();
public: 
	static HRESULT Create(CDependencyObject * * ppObject, CREATEPARAMETERS * pCreate);
	virtual XUINT32 GetTypeIndex() const;
	virtual HRESULT CreateBrushSpan(const CMILMatrix *, const struct XRECTF_WH *, struct IBrushSpan * *) = 0;
	virtual XINT32 NeedsBounds();
	virtual XINT32 HasClipRect();
	virtual void GetNaturalBounds(struct XRECTF_WH * pNaturalBounds);
	virtual HRESULT ComputeDeviceToSource(const CMILMatrix * pWorldTransform, const struct XRECTF_WH * pRenderBounds, CMILMatrix * pDeviceToSource, XBOOL bForRendering);
	virtual HRESULT GetValue(CDependencyProperty * pdp, CValue * pValue);
	virtual HRESULT HitTestBrushClipInLocalSpace(const struct XRECTF_WH * pGeometryRenderBounds, const HitTestPolygon & target, XBOOL * pIsHit);
	virtual HRESULT HitTestBrushClipInLocalSpace(const struct XRECTF_WH * pGeometryRenderBounds, const struct XPOINTF & target, XBOOL * pIsHit);
	CTransform * m_pTransform;
	CTransform * m_pRelative;
	XFLOAT m_eOpacity;
	virtual HRESULT D2DEnsureDeviceIndependentResources(const struct D2DPrecomputeParams & cp, const CMILMatrix * pMyAccumulatedTransform, const struct XRECTF_RB * pBrushBounds, struct AcceleratedBrushParams * pPALBrushParams);
	virtual HRESULT UpdateAcceleratedBrush(const struct D2DRenderParams & renderParams);
	void ReleaseAcceleratedBrush();
	struct IPALAcceleratedBrush * GetAcceleratedBrush();
	virtual HRESULT GetPrintBrush(const struct D2DRenderParams & printParams, struct IPALAcceleratedBrush * * ppBrush);
protected: 
	struct IPALAcceleratedBrush * m_pPALBrush;
};


